"""bookmanager002 URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,re_path
from book.views import index, detail, set_cookie, get_cookie, set_session,get_session,HomeView

urlpatterns = [
    # name就是给url起个名字

    re_path(r'^index/$', index,name='index'),
    # 分组获取正则,分组会传递给调用的函数
    # 根据位置获取url中的参数，可以指定标识符分组,关键字参数名字要对应
    re_path(r'^(?P<a>\d+)/(?P<b>\d+)/$',detail),
    re_path(r'^set_cookie/$',set_cookie),
    re_path(r'^get_cookie/$',get_cookie),
    re_path(r'^set_session/$',set_session),
    re_path(r'^get_session/$',get_session),
    # re_path(r'^login/$',LoginView.as_view()),
    re_path(r'^home/$',HomeView.as_view()),
]
